<script>
  import { getPlayer, getTime } from '$lib';
  import { getPos3 } from '$lib/pos3';

  let { world, tick, zoomlevel } = $props();
  let clock = $derived((tick, getTime(world)));

  const placeDescription = (z) => {
    if (z === 0)
      return "island";
    return `underground ${-z}`;
  };

  let place = $derived((tick, placeDescription(getPos3(getPlayer(world)).z)));

  let style = $derived(`font-size: ${zoomlevel*0.7}px`);
</script>

<section {style}>
  {clock} | {place}
</section>
